package com.tanhua.app.controller;

import com.tanhua.app.service.BaiduService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping(value = "/baidu")
public class BaiduController {

    @Autowired
    private BaiduService baiduService;

    @PostMapping(value = "/location",name = "上传用户地址位置")
    public ResponseEntity location(@RequestBody Map map) {
        Double x_longitude = (Double) map.get("longitude");
        Double y_latitude = (Double) map.get("latitude");
        String addrStr = (String) map.get("addrStr");

        //手机是正常切准确的  模拟器是不准确的
        x_longitude=116.635672;
        y_latitude=40.169419;
        addrStr="黑马程序员(顺义校区)";
        return baiduService.saveLocation(x_longitude,y_latitude,addrStr);
    }


}
